<?php
class ErrorController extends CController
{
    public function actionIndex()
    {
        $error = Yii::app()->errorHandler->error;
        if(!$error)
        {
            return;
        }
        
        if(Yii::app()->request->isAjaxRequest)
        {
            print_r($error);
        }
        else
        {
            $this->render('index', array('error' => $error));
        }
    }
}
